package com.oma.testcase;


import java.util.List;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class Select_Applicant extends Webdriver {
	
	String refNum = "";
	
	public String review(WebDriver driver) throws Exception {
		
		driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
		driver.findElement(By.xpath("//a[@id='DataTables_Table_0_last']")).click();
		
		List<WebElement> rows = driver.findElements(By.xpath("//table[@id='DataTables_Table_0']/tbody/tr"));
		int size = rows.size();
		//size--;
		refNum = driver.findElement(By.xpath("//table[@id='DataTables_Table_0']/tbody/tr["+size+"]/td[1]")).getText();
		System.out.println(refNum);
		driver.findElement(By.xpath("//table[@id='DataTables_Table_0']/tbody/tr["+size+"]/td[9]/a")).click();
		
		
		//List<WebElement> Industry = driver.findElements(By.id("DataTables_Table_0")).findElements(By.tagName("option"));
		//WebElement eye = driver.findElement(By.xpath("//tr/td[contains(., '"+refNum+"')]sibling::/td[8]/a/i"));
		//eye.click();
		 
		driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
		try{
			driver.findElement(By.xpath("//h4[contains(., 'PRIMARY SOURCE VERIFICATION AND TRACKING')]"));
			System.out.println("Displayed account of: " +refNum);
		}catch(Exception e){
			System.out.println("Unable to display account of: " +refNum);
		}
	
		return refNum;
	}
	
	
}
